package com.blueocean_health.care.management.controller.app;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.blueocean_health.care.management.domain.base.Param;
import com.blueocean_health.care.management.domain.base.SysResult;
import com.blueocean_health.care.management.domain.ordervo.Criteria;
import com.blueocean_health.care.management.service.IParamService;

/**
 * 城市列表：现城市只有省一级，暂存储在字典表
* @author huyanqiu
* @version 2017年8月30日 下午3:11:05
*/
@RestController
@RequestMapping(value="/app/area")
public class AppAreaController {
	
	@Resource
	private IParamService paramService;
	/**
	 * 获取指定类型的参数列表
	 * @param paramType
	 * @return
	 */
	@RequestMapping(value="list")
	public SysResult listArea(){
		Criteria criteria = new Criteria();
		String[] type = {"province"};
		criteria.setType(type);
		criteria.setDisplay("1");
		List<Param> params = paramService.getParams(criteria);
		if (StringUtils.isEmpty(params)) {
			return SysResult.ok( new ArrayList<>());
		}
		return SysResult.ok(params.get(0).getItems());
	}
	
}
